<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
<th:block th:include="include :: header('附件查看')" />
<th:block th:include="include :: ztree-css" />
<style>
.big_div {
	text-align: center;
	margin: 0 auto;
	padding: 0;
	clear: both;
	height: auto;
}

.small1, .small2, .small3 {
	width: 110px;
	height: 500px;
	line-height: 20px;
	margin: 0;
	padding: 0;
	display: inline-block;
	_display: inline;
	*display: inline;
	zoom: 1;
	overflow: auto;
}

.list{
    margin: 0px;
    padding: 0px;
    list-style-type: none
    }
   
.imgSty{
    width: 100px; 
    height: 100px
}
</style>
</head>
<body class="white-bg">
	<div class="wrapper wrapper-content animated fadeInRight ibox-content">
		<form class="form-horizontal m" id="f_sz" th:object="${enterprise}">
			<input id="rectId" name="enterpriseId" type="hidden"
				th:field="*{enterpriseId}" />

			<!--<div class="form-group" style="display:inline">
				<label >餐饮菜品图片：</label>
				<div style="width:1000px;height:200px;overflow: auto">
					<li th:each="item : ${enterprise.attachs}">
					   
					     <img alt="" th:src="${item.attWebUrl}" style="width:200px;height:200px"/>
					    
					    <div style="width:1000px;height:20px"></div>
					    
					
					</li>
				</div>
			</div>	 -->
			<div class="big_div">
				<div class="small1">

					<label>餐饮菜品图片：</label>
					<ul  class="list">
					<li th:each="item : ${enterprise.attachs}"
						th:if="${item.attFkName== 't_enterprise_food'}"><img alt=""
						th:src="${item.attWebUrl}" class="imgSty" />
						<a href="#" th:onclick="|deleteFJ('${item.attId}')|">删除 </a></li>
                     </ul>

				</div>
				<div class="small2">
					<label>餐厅环境图片：</label>
					<ul  class="list">
					<li th:each="item : ${enterprise.attachs}"
						th:if="${item.attFkName== 't_enterprise_env'}"><img alt=""
						th:src="${item.attWebUrl}" class="imgSty" />
						<a href="#" th:onclick="|deleteFJ('${item.attId}')|">删除 </a></li>
					</li>
					</ul>
				</div>
				<div class="small3">
					<label>营业执照图片：</label>
					<ul  class="list">
					<li th:each="item : ${enterprise.attachs}"
						th:if="${item.attFkName== 't_enterprise_license'}"><img
						alt="" th:src="${item.attWebUrl}"
						class="imgSty" /> <a href="#"
						th:onclick="|deleteFJ('${item.attId}')|">删除 </a></li>
					</li>
					</ul>
				</div>
				
				<div class="small3">
					<label>餐饮企业logo：</label>
					<ul  class="list">
					<li th:each="item : ${enterprise.attachs}"
						th:if="${item.attFkName== 't_enterprise_logo'||item.attFkName== 't_enterprise_set_logo'}"><img
						alt="" th:src="${item.attWebUrl}"
						class="imgSty" /> <a href="#"
						th:onclick="|deleteFJ('${item.attId}')|">删除 </a><a href="#"
						th:onclick="|setLogo('${item.attId}','${enterprise.enterpriseId}')|">设置 </a><a href="#"
						th:if="${item.attFkName== 't_enterprise_set_logo'}">logo </a></li>
					</li>
					</ul>
				</div>
				
				<div class="small3">
					<label>餐饮企业视频：</label>
					<ul  class="list">
					<li th:each="item : ${enterprise.attachs}"
						th:if="${item.attFkName== 't_enterprise_video'}"><embed
						 th:src="${item.attWebUrl}"
						 loop="true" autostart="true"
						  style="object-fit: scale-down"
						  class="imgSty"
						/> <a href="#"
						th:onclick="|deleteFJ('${item.attId}')|">删除 </a></li>
					</li>
					</ul>
				</div>

			</div>

		</form>
	</div>
	<th:block th:include="include :: footer" />
	<th:block th:include="include :: ztree-js" />
	<script type="text/javascript">
		$("#f_sz").validate();

		function submitHandler() {
			if ($.validate.form()) {
				$.modal.close();
			}
		};
		
		function setLogo(attId,enterpriseId){
			if(confirm("确认要设置为logo？")){
				var params = {
			            "attId":attId,
			            "enterpriseId":enterpriseId
			        }
				$.ajax({
					cache : true,
					type : "POST",
					dataType : 'json',
					url : ctx + "tAttach/setLogo",
					data : params,
					//contentType : "application/json",
					error : function(request) {
						$.modal.alertError("系统错误");
					},
					success : function(data) {
						//$.operate.successCallback(data);	
						//$.modal.alertSuccess("删除成功");
						//alert(data.msg);
						location.reload();
						
					}
				});
			}
			
		}

		function deleteFJ(attId) {
			if(confirm("确认要删除？")){
				var attIds = [];
				attIds[0] = attId;

				$.ajax({
					cache : true,
					type : "POST",
					dataType : 'json',
					url : ctx + "tAttach/delete",
					data : JSON.stringify(attIds),
					contentType : "application/json",
					error : function(request) {
						$.modal.alertError("系统错误");
					},
					success : function(data) {
						//$.operate.successCallback(data);	
						//$.modal.alertSuccess("删除成功");
						//alert(data.msg);
						location.reload();
						
					}
				});
			}
			

		}
	</script>

</body>
</html>
